package com.epalmpay.controller.channel.profitmanage;

import com.epalmpay.commom.BaseController;
import com.epalmpay.dto.system.PageDTO;
import com.epalmpay.entity.profit.ProfitShopMonth;
import com.epalmpay.exception.ApplicationException;
import com.epalmpay.status.Rescode;
import com.epalmpay.dto.profitmanage.*;
import com.epalmpay.dto.system.BaseOutDTO;
import com.epalmpay.dto.yunliu.profit.*;
import com.epalmpay.entity.*;
import com.epalmpay.entity.profit.ProfitAgentMonth;
import com.epalmpay.service.operator.ISysLogService;

import com.epalmpay.service.profitmanage.IProfitManageService;
import com.epalmpay.util.Tools;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping(value="/merchant/profitmanage")
public class ProfitManageController extends BaseController {
     
	@Resource
	private IProfitManageService profitManageService;
	
	@Resource
	private ISysLogService sysLogService;
	/**
	 * 显示分润分页列表
	 * 
	 */
	@RequestMapping(value="/list")
	@ResponseBody
	public ProfitListOutDTO  listQuery(ProfitInDTO profitInDTO,PageDTO pageDTO){
		ProfitListOutDTO result = null;
		Page page= Tools.pageEmtity(pageDTO);
		try {
			//获取分润列表信息
			result = profitManageService.getProfitList(profitInDTO,page);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setPage(page);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) { 
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		 catch (Exception e) { 
			 result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	/**
	 * 显示月分润分页列表
	 *
	 */
	@RequestMapping(value="/groupstatis")
	@ResponseBody
	public ProfitListOutDTO  groupstatis(@RequestBody ProfitInDTO profitInDTO){
		ProfitListOutDTO result = null;
		try {
			//获取分润列表信息
			result = profitManageService.getGroupStatis(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	/**
	 *
	 *
	 */
	@RequestMapping(value="/toAgentProfitMonthDetailPage")
	@ResponseBody
	public ProfitAgentMonthDetailDTO  toAgentProfitMonthDetailPage(@RequestBody ProfitInDTO profitInDTO){
		ProfitAgentMonthDetailDTO result = null;
		try {
			//获取分润列表信息
			result = profitManageService.toAgentProfitMonthDetailPage(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	/**
	 *
	 *
	 */
	@RequestMapping(value="/getAgentProfitMonthByYear")
	@ResponseBody
	public ProfitListOutDTO  getAgentProfitMonthByYear(@RequestBody ProfitInDTO profitInDTO){
		ProfitListOutDTO result = null;
		try {
			//获取分润列表信息
			result = profitManageService.getAgentProfitMonthByYear(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	@RequestMapping(value="/toGroupProfitMonthDetailPage")
	@ResponseBody
	public ProfitAgentMonthDetailDTO  toGroupProfitMonthDetailPage(@RequestBody ProfitInDTO profitInDTO){
		ProfitAgentMonthDetailDTO result = null;
		try {
			//获取分润列表信息
			result = profitManageService.toGroupProfitMonthDetailPage(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	/**
	 *
	 *
	 */
	@RequestMapping(value="/confirmProfitAmount")
	@ResponseBody
	public BaseOutDTO confirmProfitAmount(@RequestBody ProfitInDTO profitInDTO){
		BaseOutDTO result = null;
		try {
			//获取分润列表信息
			result = profitManageService.updateConfirmProfitAmount(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	/**
	 *
	 *
	 */
	@RequestMapping(value="/updateProfitAmount")
	@ResponseBody
	public BaseOutDTO updateProfitAmount(@RequestBody ProfitAgentMonth profitInDTO){
		BaseOutDTO result = new BaseOutDTO();
		try {
			//获取分润列表信息
			profitManageService.updateProfitAmount(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	/**
	 *
	 *
	 */
	@RequestMapping(value="/updateShopProfitAmount")
	@ResponseBody
	public BaseOutDTO updateShopProfitAmount(@RequestBody ProfitShopMonth profitInDTO){
		BaseOutDTO result = new BaseOutDTO();
		try {
			//获取分润列表信息
			profitManageService.updateShopProfitAmount(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	/**
	 *
	 *
	 */
	@RequestMapping(value="/toShopProfitMonthDetailPage")
	@ResponseBody
	public ProfitShopMonthDetailDTO  toShopProfitMonthDetailPage(@RequestBody ProfitInDTO profitInDTO){
		ProfitShopMonthDetailDTO result = null;
		try {
			//获取分润列表信息
			result = profitManageService.toShopProfitMonthDetailPage(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	@RequestMapping(value="/confirmShopProfitAmount")
	@ResponseBody
	public BaseOutDTO confirmShopProfitAmount(@RequestBody ProfitInDTO profitInDTO){
		BaseOutDTO result = null;
		try {
			//获取分润列表信息
			result = profitManageService.updateConfirmShopProfitAmount(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	@RequestMapping(value="/toProfitAgentShopTradeDayDetailList")
	@ResponseBody
	public ProfitTradeDayDetailDTO  toProfitAgentShopTradeDayDetailList(@RequestBody ProfitInDTO profitInDTO){
		ProfitTradeDayDetailDTO result = null;
		try {
			//获取分润列表信息
			result = profitManageService.toProfitAgentShopTradeDayDetailList(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	@RequestMapping(value="/toProfitAgentShopOtherDayDetailList")
	@ResponseBody
	public ProfitOtherDayDetailDTO  toProfitAgentShopOtherDayDetailList(@RequestBody ProfitInDTO profitInDTO){
		ProfitOtherDayDetailDTO result = null;
		try {
			//获取分润列表信息
			result = profitManageService.toProfitAgentShopOtherDayDetailList(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	@RequestMapping(value="/toProfitShopTradeDayDetailList")
	@ResponseBody
	public ProfitTradeDayDetailDTO  toProfitShopTradeDayDetailList(@RequestBody ProfitInDTO profitInDTO){
		ProfitTradeDayDetailDTO result = null;
		try {
			//获取分润列表信息
			result = profitManageService.toProfitShopTradeDayDetailList(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	@RequestMapping(value="/toProfitShopOtherDayDetailList")
	@ResponseBody
	public ProfitOtherDayDetailDTO  toProfitShopOtherDayDetailList(@RequestBody ProfitInDTO profitInDTO){
		ProfitOtherDayDetailDTO result = null;
		try {
			//获取分润列表信息
			result = profitManageService.toProfitShopOtherDayDetailList(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	@RequestMapping(value="/toProfitGroupShopTradeDayDetailList")
	@ResponseBody
	public ProfitTradeDayDetailDTO  toProfitGroupShopTradeDayDetailList(@RequestBody ProfitInDTO profitInDTO){
		ProfitTradeDayDetailDTO result = null;
		try {
			//获取分润列表信息
			result = profitManageService.toProfitGroupShopTradeDayDetailList(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}

	@RequestMapping(value="/toProfitGroupShopOtherDayDetailList")
	@ResponseBody
	public ProfitOtherDayDetailDTO  toProfitGroupShopOtherDayDetailList(@RequestBody ProfitInDTO profitInDTO){
		ProfitOtherDayDetailDTO result = null;
		try {
			//获取分润列表信息
			result = profitManageService.toProfitGroupShopOtherDayDetailList(profitInDTO);
			//result.setProfitOutDTOList(profitOutDTOList);
			result.setErrorCode(Rescode.SUCCESS, "处理成功");
			return result;
		} catch (ApplicationException ae) {
			result.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			result.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return result;
	}



	@RequestMapping(value="/getPolicyProfitRule")
	@ResponseBody
	public PolicyProfitRuleOutDTO GetPolicyProfitRule(@RequestBody YsPolicyProfitRule YsPolicyProfitRule){
		PolicyProfitRuleOutDTO policyProfitRuleOutDTO=new PolicyProfitRuleOutDTO();
		try {
			policyProfitRuleOutDTO = profitManageService.GetPolicyProfitRule(YsPolicyProfitRule);
			policyProfitRuleOutDTO.setErrorCode(Rescode.SUCCESS, "处理成功");
			return policyProfitRuleOutDTO;
		} catch (ApplicationException ae) {
			policyProfitRuleOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			policyProfitRuleOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return policyProfitRuleOutDTO;
	}

	@RequestMapping(value="/setPolicyProfitRule")
	@ResponseBody
	public PolicyProfitRuleOutDTO  SetPolicyProfitRule(@RequestBody YsPolicyProfitRule ysObdProfitRule){
		PolicyProfitRuleOutDTO policyProfitRuleOutDTO=new PolicyProfitRuleOutDTO();
		try {
			policyProfitRuleOutDTO = profitManageService.SetPolicyProfitRule(ysObdProfitRule);

			return policyProfitRuleOutDTO;
		} catch (ApplicationException ae) {
			policyProfitRuleOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			policyProfitRuleOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return policyProfitRuleOutDTO;
	}



	@RequestMapping(value="/setPolicyProfitCity")
	@ResponseBody
	public PolicyProfitRuleOutDTO  SetPolicyProfitCity(@RequestBody YsPolicyProfitCity ysObdProfitCity){
		PolicyProfitRuleOutDTO policyProfitRuleOutDTO=new PolicyProfitRuleOutDTO();
		try {
			policyProfitRuleOutDTO = profitManageService.SetPolicyProfitCity(ysObdProfitCity);

			return policyProfitRuleOutDTO;
		} catch (ApplicationException ae) {
			policyProfitRuleOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			policyProfitRuleOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return policyProfitRuleOutDTO;
	}


	@RequestMapping(value="/getOpenCreditCardRule")
	@ResponseBody
	public OpenCreditCardProfitRuleOutDTO GetOpenCreditCardRule(@RequestBody YsOpenCreditProfitRule YsOpenCreditProfitRule){
		OpenCreditCardProfitRuleOutDTO openCreditCardProfitRuleOutDTO=new OpenCreditCardProfitRuleOutDTO();
		try {
			openCreditCardProfitRuleOutDTO = profitManageService.GetOpenCreditCardRule(YsOpenCreditProfitRule);
			openCreditCardProfitRuleOutDTO.setErrorCode(Rescode.SUCCESS, "处理成功");
			return openCreditCardProfitRuleOutDTO;
		} catch (ApplicationException ae) {
			openCreditCardProfitRuleOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			openCreditCardProfitRuleOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return openCreditCardProfitRuleOutDTO;
	}

	@RequestMapping(value="/setOpenCreditCardRule")
	@ResponseBody
	public OpenCreditCardProfitRuleOutDTO SetOpenCreditCardRule(@RequestBody YsOpenCreditProfitRule YsOpenCreditProfitRule){
		OpenCreditCardProfitRuleOutDTO openCreditCardProfitRuleOutDTO=new OpenCreditCardProfitRuleOutDTO();
		try {
			openCreditCardProfitRuleOutDTO = profitManageService.SetOpenCreditCardRule(YsOpenCreditProfitRule);
			return openCreditCardProfitRuleOutDTO;
		} catch (ApplicationException ae) {
			openCreditCardProfitRuleOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			openCreditCardProfitRuleOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return openCreditCardProfitRuleOutDTO;
	}


	@RequestMapping(value="/getPolicyList")
	@ResponseBody
	public PolicyProfitListOutDTO getPolicyList(@RequestBody YsPolicyProfitRule ysPolicyProfitRule){
		PolicyProfitListOutDTO policyProfitListOutDTO=new PolicyProfitListOutDTO();
		try {
			policyProfitListOutDTO = profitManageService.getPolicyList(ysPolicyProfitRule);
			policyProfitListOutDTO.setErrorCode(Rescode.SUCCESS, "处理成功");
			return policyProfitListOutDTO;
		} catch (ApplicationException ae) {
			policyProfitListOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			policyProfitListOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return policyProfitListOutDTO;
	}


	@RequestMapping(value="/deletePolicyProfitRule")
	@ResponseBody
	public PolicyProfitRuleOutDTO  deletePolicyProfitRule(@RequestBody YsPolicyProfitRule ysPolicyProfitRule){
		PolicyProfitRuleOutDTO policyProfitRuleOutDTO=new PolicyProfitRuleOutDTO();
		try {
			policyProfitRuleOutDTO = profitManageService.deletePolicyProfitRule(ysPolicyProfitRule);
			policyProfitRuleOutDTO.setErrorCode(Rescode.SUCCESS, "处理成功");
			return policyProfitRuleOutDTO;
		} catch (ApplicationException ae) {
			policyProfitRuleOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			policyProfitRuleOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return policyProfitRuleOutDTO;
	}

	@RequestMapping(value="/deletePolicyProfitCity")
	@ResponseBody
	public PolicyProfitRuleOutDTO  deletePolicyProfitCity(@RequestBody YsPolicyProfitCity ysPolicyProfitCity){
		PolicyProfitRuleOutDTO policyProfitRuleOutDTO=new PolicyProfitRuleOutDTO();
		try {
			policyProfitRuleOutDTO = profitManageService.deletePolicyProfitCity(ysPolicyProfitCity);
			policyProfitRuleOutDTO.setErrorCode(Rescode.SUCCESS, "处理成功");
			return policyProfitRuleOutDTO;
		} catch (ApplicationException ae) {
			policyProfitRuleOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			policyProfitRuleOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return policyProfitRuleOutDTO;
	}




	@RequestMapping(value="/getCreditCardOpenCardList")
	@ResponseBody
	public CreditCardOpenCardListOutDTO getCreditCardOpenCardList(@RequestBody YsOpenCreditProfitRule ysOpenCreditProfitRule){
		CreditCardOpenCardListOutDTO creditCardOpenCardListOutDTO=new CreditCardOpenCardListOutDTO();
		try {
			creditCardOpenCardListOutDTO = profitManageService.getCreditCardOpenCardList(ysOpenCreditProfitRule);
			creditCardOpenCardListOutDTO.setErrorCode(Rescode.SUCCESS, "处理成功");
			return creditCardOpenCardListOutDTO;
		} catch (ApplicationException ae) {
			creditCardOpenCardListOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			creditCardOpenCardListOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return creditCardOpenCardListOutDTO;
	}


	@RequestMapping(value="/deleteCreditCardOpenCardProfitRule")
	@ResponseBody
	public OpenCreditCardProfitRuleOutDTO  deleteCreditCardOpenCardProfitRule(@RequestBody YsOpenCreditProfitRule ysOpenCreditProfitRule){
		OpenCreditCardProfitRuleOutDTO openCreditCardProfitRuleOutDTO=new OpenCreditCardProfitRuleOutDTO();
		try {
			openCreditCardProfitRuleOutDTO = profitManageService.deleteCreditCardOpenCardProfitRule(ysOpenCreditProfitRule);
			openCreditCardProfitRuleOutDTO.setErrorCode(Rescode.SUCCESS, "处理成功");
			return openCreditCardProfitRuleOutDTO;
		} catch (ApplicationException ae) {
			openCreditCardProfitRuleOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			openCreditCardProfitRuleOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return openCreditCardProfitRuleOutDTO;
	}


	@RequestMapping(value="/queryYsCityList")
	@ResponseBody
	public YsCityListOutDTO  queryYsCityList(@RequestBody YsCity ysCity){
		YsCityListOutDTO ysCityListOutDTO=new  YsCityListOutDTO();
		try {
			ysCityListOutDTO = profitManageService.queryYsCityList(ysCity);
			ysCityListOutDTO.setErrorCode(Rescode.SUCCESS, "处理成功");
			return ysCityListOutDTO;
		} catch (ApplicationException ae) {
			ysCityListOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			ysCityListOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return ysCityListOutDTO;
	}




	@RequestMapping(value="/creditCardOpenCardProfitCalculate")
	@ResponseBody
	public BaseOutDTO  creditCardOpenCardProfitCalculate(@RequestBody List<YsCreditCardInfo> ysCreditCardInfoList){
		BaseOutDTO baseOutDTO=new  BaseOutDTO();
		try {
			for (YsCreditCardInfo ysCreditCardInfo:
			ysCreditCardInfoList) {
				int status = profitManageService.insertCreditOpenCardProfitCalculate(ysCreditCardInfo.getUserName(),"");
				if (status>0){
					continue;
				}else{
					baseOutDTO.setErrorCode(Rescode.FAIL, "信用卡分润数据异常");
					return baseOutDTO;
				}
			}


			baseOutDTO.setErrorCode(Rescode.SUCCESS, "处理成功");
			return baseOutDTO;
		} catch (ApplicationException ae) {
			baseOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			baseOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return baseOutDTO;
	}



	@RequestMapping(value="/addCityToPolicyList")
	@ResponseBody
	public BaseOutDTO  addCityToPolicyList(@RequestBody YsCity ysCity){
		BaseOutDTO baseOutDTO=new  BaseOutDTO();
		try {

			int status = profitManageService.addCityToPolicyList(ysCity);

			if (status>0){
				baseOutDTO.setErrorCode(Rescode.SUCCESS, "处理成功");
				return baseOutDTO;
			}else{
				baseOutDTO.setErrorCode(Rescode.FAIL, "地区分润数据异常");
			}



		} catch (ApplicationException ae) {
			baseOutDTO.setErrorCode(ae.errCode, ae.errMsg);
			ae.printStackTrace();
			logger.error(ae);
		}
		catch (Exception e) {
			baseOutDTO.setErrorCode(Rescode.DEFAULT_PREFIX, "处理出现异常");
			e.printStackTrace();
			logger.error(e);
		}
		return baseOutDTO;
	}


}
